<template>
        <el-card shadow="never" style="max-height: 700px; overflow: auto">
            <el-form ref="form" :model="form" :rules="rules" label-width="90px" :disabled="disabled">
                <el-form-item label="id:" prop="id" v-show="false">
                    <el-input v-model="form.id" disabled />
                </el-form-item>
                <el-form-item label="createtime:" prop="createtime">
                    <el-date-picker v-model="form.createtime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择createtime" />
                </el-form-item>        

                <el-form-item label="updatetime:" prop="updatetime">
                    <el-date-picker v-model="form.updatetime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择updatetime" />
                </el-form-item>        

                <el-form-item label="GoodsID:" prop="GoodsID">
                    <el-input v-model="form.GoodsID" placeholder="请输入GoodsID" clearable />
                </el-form-item>
                <el-form-item label="SKU:" prop="SKU">
                    <el-input v-model="form.SKU" placeholder="请输入SKU" clearable />
                </el-form-item>
                <el-form-item label="GoodsCode:" prop="GoodsCode">
                    <el-input v-model="form.GoodsCode" placeholder="请输入GoodsCode" clearable />
                </el-form-item>
                <el-form-item label="CnName:" prop="CnName">
                    <el-input v-model="form.CnName" placeholder="请输入CnName" clearable />
                </el-form-item>
                <el-form-item label="EnName:" prop="EnName">
                    <el-input v-model="form.EnName" placeholder="请输入EnName" clearable />
                </el-form-item>
                <el-form-item label="Price:" prop="Price">
                    <el-input-number v-model="form.Price" :step="0.01" :min="0"></el-input-number>
                </el-form-item>
                <el-form-item label="Weight:" prop="Weight">
                    <el-input v-model="form.Weight" placeholder="请输入Weight" clearable />
                </el-form-item>
                <el-form-item label="Length:" prop="Length">
                    <el-input v-model="form.Length" placeholder="请输入Length" clearable />
                </el-form-item>
                <el-form-item label="Width:" prop="Width">
                    <el-input v-model="form.Width" placeholder="请输入Width" clearable />
                </el-form-item>
                <el-form-item label="High:" prop="High">
                    <el-input v-model="form.High" placeholder="请输入High" clearable />
                </el-form-item>
                <el-form-item label="RealWeight:" prop="RealWeight">
                    <el-input v-model="form.RealWeight" placeholder="请输入RealWeight" clearable />
                </el-form-item>
                <el-form-item label="RealLength:" prop="RealLength">
                    <el-input v-model="form.RealLength" placeholder="请输入RealLength" clearable />
                </el-form-item>
                <el-form-item label="RealWidth:" prop="RealWidth">
                    <el-input v-model="form.RealWidth" placeholder="请输入RealWidth" clearable />
                </el-form-item>
                <el-form-item label="RealHigh:" prop="RealHigh">
                    <el-input v-model="form.RealHigh" placeholder="请输入RealHigh" clearable />
                </el-form-item>

                <el-form-item>
                    <el-button type="primary" @click="submitForm">确认 </el-button>
                    <el-button type="warning" @click="cancel">取消 </el-button>
                </el-form-item>
            </el-form>
        </el-card>
</template>

<script>
export default {
    name: 'EditForm',
    props: {
        findFormData: {
            type: Object,
            default: {}
        },
        editFormParams: {
            type: Object,
            default: {}
        },
        // 表单是否禁用
        disabled: {
            type: Boolean,
            default: false,
        },
        
    },
    data() {
        return {
            // 编辑表单验证规则
            rules: {
        
            },
            form: {  },
          

        }
    },
    watch: {
        findFormData: {
           handler(nval) {
                if (JSON.stringify(nval) != '{}') {
                    this.$nextTick(() => {
                        this.form = nval
                    })
                }
            },
            immediate: true,
            deep: false,
        },
        
    },
    methods: {
        // 取消按钮
        cancel() {
            this.$emit('editFormCancel')
        },

        submitForm() {
            this.$refs['form'].validate((valid, obj) => {
                if (valid) {
                    this.$emit('submitForm', this.form)
                }
            })
        },

        // 表单重置
        reset() {
            this.resetForm('form')
        }
    }
}
</script>
